{template '_header'}
<style type='text/css'>
    .ordertable {
        width: 100%;
        position: relative;
        margin-bottom: 10px
    }

    .ordertable tr td:first-child {
        text-align: right
    }

    .ordertable tr td {padding:10px 5px 0;vertical-align: top} .ordertable1 tr td {
        text-align: right;
    }

    .ops .btn {
        padding: 5px 10px;
    }
</style>
<div class="page-header">当前位置：<span class="text-primary">订单详情</span></div>

<div class="page-content">
    {if $item['status']!=-1}
    <div class="step-region" >
        <ul class="ui-step ui-step-4" >
            <li {if 1<=$item['status']}class="ui-step-done"{/if}>
            <div class="ui-step-number" >1</div>
            <div class="ui-step-title" >买家下单</div>
            <div class="ui-step-meta" >{if 0<=$item['status']}{php echo date('Y-m-d',$item['createtime'])}<br/>{php echo date('H:i:s',$item['createtime'])}{/if}</div>
            </li {if 1<=$item['status']}class="ui-step-done"{/if}>
            <li {if 2<=$item['status'] || ($item['status']==1 && $item['sendtype'] > 0)}class="ui-step-done"{/if}>
            <div class="ui-step-number" >2</div>
            <div class="ui-step-title">买家付款</div>
            <div class="ui-step-meta">
                {if 2<=$item['status']}{php echo date('Y-m-d',$item['paytime'])}
                <br/>
                {php echo date('H:i:s',$item['paytime'])}{/if}
            </div>
            </li>
            {if $item['status'] < 5 }
            <li {if 3<=$item['status']}class="ui-step-done"{/if}>
            <div class="ui-step-number">3</div>
            <div class="ui-step-title">订单完成</div>
            <div class="ui-step-meta">
                {if 3<=$item['status']}{php echo date('Y-m-d',$item['finishtime'])}
                <br/>
                {php echo date('H:i:s',$item['finishtime'])}{/if}
            </div>
            </li>
            <li {if 4<=$item['status']}class="ui-step-done"{/if}>
            <div class="ui-step-number">X</div>
            <div class="ui-step-title">订单关闭</div>
            <div class="ui-step-meta">
                {if 4<=$item['status']}{php echo date('Y-m-d',$item['canceltime'])}
                <br/>
                {php echo date('H:i:s',$item['canceltime'])}{/if}
            </div>
            </li>
            {else}
            <li {if 5<=$item['status']}class="ui-step-done"{/if}>
            <div class="ui-step-number">3</div>
            <div class="ui-step-title">订单维权</div>
            <div class="ui-step-meta">{if 5<=$item['status']}{php echo date('Y-m-d',$item['refundtime'])}
                <br/>
                {php echo date('H:i:s',$item['refundtime'])}{/if}</div>
            </li>
            <li {if 6<=$item['status']}class="ui-step-done"{/if}>
            <div class="ui-step-number">4</div>
            <div class="ui-step-title">维权完成</div>
            <div class="ui-step-meta">
                {if 6<=$item['status']}{php echo date('Y-m-d',$item['cancetime'])}
                <br/>
                {php echo date('H:i:s',$item['cancetime'])}{/if}
            </div>
            </li>
            {/if}
        </ul>
    </div>
    {/if}

<form class="form-horizontal form" action="" method="post">
    <input type="hidden" name="id" value="{$item['id']}"/>

    <input type="hidden" name="dispatchid" value="{$dispatch['id']}"/>

    <div class='row order-container'>
        <div style="padding-left: 15px">

            {if $item['status'] < 5}
                <div class='panel-body'>
                    <h4 class="m-t-none m-b">订单信息</h4>
                    <div class="" style='margin-bottom: 0;'>
                        <table class='ordertable' style='table-layout:fixed'>
                            <tr>
                                <td style='width:80px'>订单编号：</td>
                                <td>{$item['ordersn']}</td>
                            </tr>
                            <tr>
                                <td>订单金额：</td>
                                <td>￥{php echo number_format($item['price'],2)} &nbsp;&nbsp;
                                    <a data-toggle='popover'
                                        data-html='true'
                                        data-placement='right'
                                        data-content="<table style='width:100%;'>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>商品小计：</td>
                                            <td  style='border:none;text-align:right;'>￥{php echo number_format( $item['goodsprice'] ,2)}</td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>抵扣积分：</td>
                                            <td  style='border:none;text-align:right;'>{$item['goodsprice']}</td>
                                        </tr>
                                        <tr>
                                            <td style='border:none;text-align:right;'>应收款：</td>
                                            <td  style='border:none;text-align:right;color:green;'>￥{php echo number_format($item['price'],2)}</td>
                                        </tr>
                                    </table>
                                "><i class='fa fa-question-circle'></i></a></td>
                            </tr>
                            <tr>
                                <td style='width:80px'>付款方式：</td>
                                <td> {if $item['paytype'] == 0}未支付{/if}
                                    {if $item['paytype'] == 3}余额支付{/if}
                                    {if $item['paytype'] == 11}后台付款{/if}
                                    {if $item['paytype'] == 24}微信支付{/if}
                                    {if $item['paytype'] == 38}支付宝支付{/if}
                            </tr>

                            <tr>
                                <td>买家：</td>
                                <td><a href="{php echo webUrl('member/list/detail',array('id'=>$member['id']))}"
                                       target='_blank'>{$member['realname']}</a> &nbsp;&nbsp;
                                    <a data-toggle='popover'
                                        data-html='true'
                                        data-placement='right'
                                        data-content="<table style='width:100%;'>
                                        <tr>
                                            <td  style='border:none;' colspan='2'><img src='{php echo tomedia($member['avatar'])}' style='width:100px;height:100px;padding:1px;border:1px solid #ccc' /></td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>ID：</td>
                                            <td  style='border:none;'>{$member['id']}</td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>昵称：</td>
                                            <td  style='border:none;'>{$member['realname']}</td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>姓名：</td>
                                            <td  style='border:none;'>{$member['realname']}</td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>手机号：</td>
                                            <td  style='border:none;'>{$member['mobile']}</td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>微信号：</td>
                                            <td  style='border:none;'>{$member['weixin']}</td>
                                        </tr>
                                        </table>">
                                        <i class='fa fa-question-circle'></i>
                                    </a>
                                </td>
                            </tr>
                        </table>

                        <table class='ordertable' style='table-layout:fixed;border-top:1px dotted #ccc'>

                            <tr>
                                <td style='width:80px'>门店名称：</td>
                                <td>{$mendian['mendianname']}</td>
                            </tr>

                            <tr>
                                <td style='width:80px'>负责人：</td>
                                <td>
                                    <a href="{php echo webUrl('member/list/detail',array('id'=>$mendian['mid']))}"
                                       target='_blank'>{$mendian['realname']}</a> &nbsp;&nbsp;
                                    <a data-toggle='popover'
                                       data-html='true'
                                       data-placement='right'
                                       data-content="<table style='width:100%;'>
                                        <tr>
                                            <td  style='border:none;text-align:right;' colspan='2'><img src='{$mendian['avatar']}' style='width:100px;height:100px;padding:1px;border:1px solid #ccc' /></td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>ID：</td>
                                            <td  style='border:none;text-align:right;'>{$mendian['mid']}</td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>昵称：</td>
                                            <td  style='border:none;text-align:right;'>{$mendian['realname']}</td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>姓名：</td>
                                            <td  style='border:none;text-align:right;'>{$mendian['realname']}</td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>手机号：</td>
                                            <td  style='border:none;text-align:right;'>{$mendian['mobile']}</td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>微信号：</td>
                                            <td  style='border:none;text-align:right;'>{$mendian['weixin']}</td>
                                        </tr>
                                        </table>">
                                        <i class='fa fa-question-circle'></i>
                                    </a>
                                </td>
                            </tr>

                            <tr>
                                <td style='width:80px'>门店电话：</td>
                                <td>{$mendian['tel']}</td>
                            </tr>

                            <tr>
                                <td style='width:80px'>门店地址：</td>
                                <td style="word-break: break-all;white-space: normal">{$mendian['address']}</td>
                            </tr>

                        </table>

                    </div>
                </div>

            {else}
                <div class="panel-body">
                    <h4 class="m-t-none m-b">维权信息</h4>
                    <div class="" >
                        <table class="ordertable" style="table-layout:fixed">
                            <tbody><tr>
                                <td style="width:80px">维权类型：</td>
                                <td>退款</td>
                            </tr>

                            <tr>
                                <td style="width:80px">退款金额：</td>
                                <td>{php echo number_format($refund['price'], 2)}(元)</td>
                            </tr>
                            <tr>
                                <td style="width:80px">退还积分：</td>
                                <td>{$item['deductcredit']}(个)</td>
                            </tr>

                            <tr>
                                <td style="width:80px">维权原因：</td>
                                <td>{$refund['reason']}</td>
                            </tr>

                            <tr>
                                <td style="width:80px">维权说明：</td>
                                <td style="white-space: normal;">{$refund['content']}</td>
                            </tr>

                            <tr>
                                <td style="width:80px">订单编号：</td>
                                <td>{$refund['refundno']}</td>
                            </tr>

                            <tr>
                                <td>订单金额：</td>
                                <td>￥{php echo number_format($item['price'], 2)}
                                    <a data-toggle="popover" data-html="true" data-placement="right" data-content="<table style='width:100%;'>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>商品小计：</td>
                                            <td  style='border:none;text-align:right;;'>￥{php echo number_format($item['goodsprice'], 2)}</td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>积分金额：</td>
                                            <td  style='border:none;text-align:right;;'>￥{php echo number_format($item['deductprice'], 2)}</td>
                                        </tr>                                                                                                                         <tr>
                                            <td style='border:none;text-align:right;'>实收款：</td>
                                            <td  style='border:none;text-align:right;color:green;'>￥{php echo number_format($item['realprice'], 2)}</td>
                                        </tr>
                                        </table>" data-original-title="" title="">
                                        <i class="fa fa-question-circle"></i>
                                    </a>
                                </td>
                            </tr>

                            <tr>
                                <td>买家：</td>
                                <td>{$member['realname']}
                                    <a data-toggle="popover" data-html="true" data-placement="right" data-content="<table style='width:100%;'>
                                        <tr>
                                            <td  style='border:none;text-align:right;' colspan='2'>
                                            <img src='{php echo tomedia($member['avatar'])}' style='width:100px;height:100px;padding:1px;border:1px solid #ccc' /></td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>昵称：</td>
                                            <td  style='border:none;text-align:right;'>{$member['realname']}</td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>姓名：</td>
                                            <td  style='border:none;text-align:right;'>{$member['realname']}</td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>ID：</td>
                                            <td  style='border:none;text-align:right;'>{$member['id']}</td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>手机号：</td>
                                            <td  style='border:none;text-align:right;'>{$member['mobile']}</td>
                                        </tr>
                                        <tr>
                                            <td  style='border:none;text-align:right;'>微信号：</td>
                                            <td  style='border:none;text-align:right;'>{$member['weixin']}</td>
                                        </tr>
                                        </table>" data-original-title="" title="">
                                        <i class="fa fa-question-circle"></i>
                                    </a>
                                </td>
                            </tr>

                            <tr>
                                <td style="width:80px">付款时间：</td>
                                <td>{$item['paytime']}</td>
                            </tr>

                            <tr>
                                <td style="width:80px">付款方式：</td>
                                <td>
                                    {if $item['paytype'] == 0}未支付{/if}
                                    {if $item['paytype'] == 3}余额支付{/if}
                                    {if $item['paytype'] == 11}后台付款{/if}
                                    {if $item['paytype'] == 24}微信支付{/if}
                                    {if $item['paytype'] == 38}支付宝支付{/if}
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>

            {/if}

        </div>
        <div  style="padding-left: 15px">
            <div class='panel-body'>
                <h4 class="m-t-none m-b">订单状态：
                    {if $item['status'] == 1}<span class="text-warning font18">待付款</span>{/if}
                    {if $item['status'] == 2}<span class="text-primary font18">进行中</span>{/if}
                    {if $item['status'] == 3}<span class="text-success font18">已完成</span>{/if}
                    {if $item['status'] == 4}<span class="text-default font18">已关闭</span>{/if}
                    {if $item['status'] == 5}<span class="text-warning font18">维权申请</span>{/if}
                    {if $item['status'] == 6}<span class="text-default font18">维权完成</span>{/if}</h4>
                <div class="" style='margin-bottom: 0;'>
                    <div class="ops  col-md-12" style="padding: 0;">
                        {template 'sorder/order/ops'}
                    </div>
                    {if $item['status'] >0}
                    <div class="order-container-footer text col-md-12" style="border: none;padding: 0">
                        友情提示：
                        {if $item['status'] == 1}
                            您可以联系买家进行付款，否则订单会根据设置自动关闭
                        {/if}
                        {if $item['status'] == 2}
                            如果买家遇到问题要退款，请及时联系买家妥善处理
                        {/if}
                        {if $item['status']==3}
                           交易成功，如买家有售后申请，请与买家进行协商，妥善处理
                        {/if}
                    </div>
                    {/if}
                </div>
            </div>
        </div>
    <br>

    {if count($agent)>0}
    <div class='row order-container' style="display: none;">
        <div class="row" style="margin: 20px 0 0 10px;">

            <div class="col-sm-4">

                <h4 class="m-t-none m-b">
                    推荐人
                </h4>
                <div class="form-group" style='padding:0 10px;'>
                    <table class='ordertable' style='table-layout:fixed'>
                        <tr>
                            <td style='width:80px'>姓名：</td>
                            <td><a href="{php echo webUrl('member/list/detail',array('id'=>$agent['id']))}"
                                   target='_blank'>{$agent['realname']}</a> &nbsp;&nbsp;<a
                                    data-toggle='popover' data-html='true' data-placement='right'
                                    data-content="<table style='width:100%;'>

                <tr>
                    <td  style='border:none;text-align:right;' colspan='2'><img src='{php echo tomedia($agent['avatar'])}' style='width:100px;height:100px;padding:1px;border:1px solid #ccc' /></td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>ID：</td>
                    <td  style='border:none;text-align:right;'>{$agent['id']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>昵称：</td>
                    <td  style='border:none;text-align:right;'>{$agent['realname']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>姓名：</td>
                    <td  style='border:none;text-align:right;'>{$agent['realname']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>手机号：</td>
                    <td  style='border:none;text-align:right;'>{$agent['mobile']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>微信号：</td>
                    <td  style='border:none;text-align:right;'>{$agent['weixin']}</td>
                </tr>
                </table>
"><i class='fa fa-question-circle'></i></a></td>
                        </tr>

                        <tr>
                            <td style='width:80px'>手机号：</td>
                            <td>{$agent['mobile']}</td>
                        </tr>

                        <tr>
                            <td style='width:80px'>佣金：</td>
                            <td>{$agent['commission']}</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <br>
    {/if}

    <div class="panel-default">
        <div class="panel-heading">
            <span>设备信息</span>
        </div>
        <div class="table-responsive" style="padding: 0 15px;">
            <table class="table table-hover">
                <thead class="navbar-inner">
                    <tr>
                        <th style="width:150px">标题</th>
                        <th style="width:200px">规格/编号/条码</th>
                        <th style="text-align: center;">门店</th>
                        <th style="text-align: center;width:250px">门店地址</th>
                        <th style="text-align: center;">价格(元)/数量</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td class='full'>{$goods['name']}</td>
                        <td class='full'>{$goods['docking_number']}</td>
                        <td style="text-align: center;">{$mendian['mendianname']}</td>
                        <td style="white-space: inherit;">{$mendian['address']}</td>
                        <td style="text-align: center;">{$goods['price']}/x1</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>

        <br>

    {if !empty($comlog)}
    <div class="panel-default">
        <div class="panel-heading">
            <span>佣金明细</span>
        </div>
        <div class="table-responsive" style="padding: 0 15px;">
            <table class="table table-hover">
                <thead class="navbar-inner">
                <tr>
                    <th style="width:150px">用户名称</th>
                    <th style="width:200px">类型</th>
                    <th style="text-align: center;">金额</th>
                </tr>
                </thead>
                <tbody>
                {loop $comlog $row}
                <tr>
                    {if empty($row['mendianid'])}
                    <td class='full'>
                        <a {ifp 'member.list.view'}href="{php echo webUrl('member/list/detail',array('id'=>$agent['id']))}"
                           target='_blank'{/if}>{$row['realname']}</a> &nbsp;&nbsp;<a
                            data-toggle='popover' data-html='true' data-placement='right'
                            data-content="<table style='width:100%;'>

                <tr>
                    <td  style='border:none;text-align:right;' colspan='2'><img src='{php echo tomedia($row['avatar'])}' style='width:100px;height:100px;padding:1px;border:1px solid #ccc' /></td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>ID：</td>
                    <td  style='border:none;text-align:right;'>{$row['mid']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>昵称：</td>
                    <td  style='border:none;text-align:right;'>{$row['realname']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>姓名：</td>
                    <td  style='border:none;text-align:right;'>{$row['realname']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>手机号：</td>
                    <td  style='border:none;text-align:right;'>{$row['mobile']}</td>
                </tr>
                <tr>
                    <td  style='border:none;text-align:right;'>微信号：</td>
                    <td  style='border:none;text-align:right;'>{$row['weixin']}</td>
                </tr>
                </table>
"><i class='fa fa-question-circle'></i></a>
                    </td>
                    {else}
                    <td>--</td>
                    {/if}
                    <td class='full'>{$level[$row['level']]}</td>
                    <td style="text-align: center;">{$row['money']}</td>
                </tr>
                {/loop}
                {if !empty($reslog)}
                    <tr>
                        <td class='full'>--</td>
                        <td class='full'>技术</td>
                        <td style="text-align: center;">{$reslog['jishu']}</td>
                    </tr>
                    <tr>
                        <td class='full'>--</td>
                        <td class='full'>奖金池</td>
                        <td style="text-align: center;">{$reslog['jiangjin']}</td>
                    </tr>
                {/if}
                </tbody>
            </table>
        </div>
    </div>
    {/if}
</form>
</div>
{template '_footer'}
